package com.wzh.live.service.impl;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzh.common.utils.PageUtils;
import com.wzh.common.utils.Query;

import com.wzh.live.dao.LiveStreamDao;
import com.wzh.live.entity.LiveStreamEntity;
import com.wzh.live.service.LiveStreamService;


@Service("liveStreamService")
public class LiveStreamServiceImpl extends ServiceImpl<LiveStreamDao, LiveStreamEntity> implements LiveStreamService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<LiveStreamEntity> wrapper = new QueryWrapper<>();
        String key = (String) params.get("key");
        if (StringUtils.isNotEmpty(key)){
            wrapper.and(w->{
               w.like("live_name",key);
            });
        }
        IPage<LiveStreamEntity> page = this.page(
                new Query<LiveStreamEntity>().getPage(params),
                wrapper
        );

        return new PageUtils(page);
    }



}